/*
循环数组，修改数组对象中的属性值key返回新数组对象(map)
*/
let arr = [
    {
        index: 1,
        title: '张三',
        sec: '男'
    },
    {
        index: 2,
        title: '李四',
        sec: '男'
    },
    {
        index: 3,
        title: '王五',
        sec: '女'
    }
];
const newArr = arr.map(v => ({ id: v.index, name: v.title, sex: v.sec }));
console.log('newArr', newArr)
//   newArr [ { id: 1, name: '张三' }, { id: 2, name: '李四' }, { id: 3, name: '王五' } ]